
using CStock;
using System;
using System.Diagnostics;
using CUtil;

using TestCases.StockData;

using NUnit.Framework;
namespace TestCases.UI.SettingsUI
{
	

	/// <summary>Some simple Tests.</summary>
	/// 
	[TestFixture]
    public class SettingsUI_Test : TestCases.StockData.ProgramContext_TestCases 
    {
        string tradeSystem = "TestTrader";
        string traderEconomyProfile = "EconomyProfile";

        public SettingsUI_Test()
        {
        }

        [Test]
        public void Settings_Sample()
        {
            Settings s = new Settings();
            MainForm mf = new MainForm();
            mf.Show();

            //traderFactory.AddDefaultPortfolio();
            //Assert.IsTrue(this.traderFactory.Serialize());

        }
        [Test]
        public void TradeSystem_CreateProfile_And_Save()
        {
            TradeSystemFactory tradeSystemFactory = new TradeSystemFactory();
            tradeSystemFactory.Create(tradeSystem);
            tradeSystemFactory.Serialize();


        }
        [Test]
        public void TradeSystem_Show()
        {
            ITradeSystemFactory tradeSystemFactory = new TradeSystemFactory();
            tradeSystemFactory.Create(tradeSystem);

            bool bSer = tradeSystemFactory.DeSerialize();
            Assert.IsTrue(bSer);
            if (bSer)
            {
                CSettingsUI.SettingForm sf = new CSettingsUI.SettingForm();
                //if (!LoadSettingClass())
                //    this.settingClass = new Settings();

                sf.SelectedObject = tradeSystemFactory.StockObjectBase;
                sf.ShowDialog();

                tradeSystemFactory.StockObjectBase = sf.SelectedObject as StockObjectBase;
                tradeSystemFactory.Serialize();
            }
            

            
        }
        [Test]
        public void EconomyProfile_Create_And_Save()
        {
            ITradeEconomyProfileFactory tradeEconomyProfileFactory = new TradeEconomyProfileFactory();
            tradeEconomyProfileFactory.Create(this.traderEconomyProfile);
            tradeEconomyProfileFactory.Serialize();


        }
        [Test]
        public void EconomyProfile_Show()
        {
            ITradeEconomyProfileFactory tradeEconomyProfileFactory = new TradeEconomyProfileFactory();
            tradeEconomyProfileFactory.Create(this.traderEconomyProfile);

            bool bSer = tradeEconomyProfileFactory.DeSerialize();
            Assert.IsTrue(bSer);
            if (bSer)
            {
                CSettingsUI.SettingForm sf = new CSettingsUI.SettingForm();
                //if (!LoadSettingClass())
                //    this.settingClass = new Settings();

                sf.SelectedObject = tradeEconomyProfileFactory.StockObjectBase;
                sf.ShowDialog();

                tradeEconomyProfileFactory.StockObjectBase = sf.SelectedObject as StockObjectBase;
                tradeEconomyProfileFactory.Serialize();
            }



        }
        [Test]
        public void Economy_Create()
        {
            TradeEconomyFactory tradeEconomyFactory = new TradeEconomyFactory();
            tradeEconomyFactory.Create_Default();
            //tradeEconomyFactory.Create_TestData(10);
            tradeEconomyFactory.Serialize();


        }
        [Test]
        public void Economy_Show()
        {
            TradeEconomyFactory tradeEconomyFactory = new TradeEconomyFactory();

            bool bSer = tradeEconomyFactory.DeSerialize();
            Assert.IsTrue(bSer);
            if (bSer)
            {
                CSettingsUI.SettingForm sf = new CSettingsUI.SettingForm();
                //if (!LoadSettingClass())
                //    this.settingClass = new Settings();

                sf.SelectedObject = tradeEconomyFactory.StockObjectBase;
                sf.ShowDialog();

                tradeEconomyFactory.StockObjectBase = sf.SelectedObject as StockObjectBase;
                tradeEconomyFactory.Serialize();
            }


        }
	}
	
}